package design

import (
	"gorm.io/driver/mysql"
	"gorm.io/gorm"
)

const localMysql = "root:root@(127.0.0.1:3306)/homestead?timeout=1000ms&charset=utf8mb4,utf8&parseTime=true&loc=Local"

var DB *gorm.DB

func getDb() {
	db, err := gorm.Open(mysql.New(mysql.Config{
		DSN: localMysql,
	}), &gorm.Config{})
	if err != nil {
		panic(err)
	}
	DB = db.Debug()
}

func init() {
	getDb()
}
